package com.lr.dao.internet.impl;

import com.lr.dao.internet.internetDao_hashmap;
import com.lr.domain.INetSaler;
import com.lr.domain.INet_hashmap;

import java.util.HashMap;
import java.util.Map;

public class internetDaoimplHashmap implements internetDao_hashmap {

   HashMap<String,INetSaler> hashMap= INet_hashmap.getHashmap();


    public void add(String net_name, INetSaler iNetSaler) {
          hashMap.put(net_name,iNetSaler);
    }

    public void delet(int id) {
        String key_get = null;
        for(String key:hashMap.keySet())
        {
            if(hashMap.get(key).getNumber()==id)
            {key_get=key;
              break;
            }
            // System.out.println(key+" "+getHashmap().get(key).getMg_name());
        }
           hashMap.remove(key_get);
    }



    public void edit(int id, INetSaler NewiNetSaler) {
        String key_get = null;
        for(String key:hashMap.keySet())
        {
            if(hashMap.get(key).getNumber()==id)
            {key_get=key;
                break;
            }
            // System.out.println(key+" "+getHashmap().get(key).getMg_name());
        }
        hashMap.put(key_get,NewiNetSaler);

    }

    public HashMap<String, INetSaler> findall() {
        return INet_hashmap.getHashmap();
    }
}
